﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class Pages_CapNhatSP : System.Web.UI.UserControl
{
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.getdanhmuc();  
        }
       

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string ma = txtmasp.Text;
        string ten = txttensp.Text;
        float gia = float.Parse(txtgia.Text);
        int sluong = int.Parse(txtsoluong.Text);
        string trthai = cbotrangthai.SelectedValue;
        Label2.Text = cbotrangthai.SelectedValue;
        string str = Server.MapPath(FileUpload1.FileName);
        string dm = cbomadm.SelectedValue;
        DALSanPham sp = new DALSanPham();
        bool success = sp.insertsp(ma, ten, gia, sluong, trthai, str, dm);
        if (success==true)
        {
            Label2.Text = "Cập nhật sản phẩm thành công!";
        }
    }
    protected void cbomadm_SelectedIndexChanged(object sender, EventArgs e)
    {
        

    }
 
    protected void getdanhmuc()
    {
     /*   DALDanhMuc dm = new DALDanhMuc();
        cbomadm.DataTextField = "TENDM";
        cbomadm.DataValueField = "MADM";
        //cbomadm.DataMember = "MADM";
        cbomadm.DataSource = dm.getDanhmuc();
        cbomadm.DataBind();
      */ 
    }
    
}